# -*- coding: utf-8 -*-
# !/usr/resources/python3

from sqlalchemy import and_
from models.Model import Model
from models.ResourceName import ResourceNameModel as Name

# model
model = Model()


class PersonName:
    # 获取单姓
    @staticmethod
    def surname():
        resources = model.all(Name, and_(
            Name.type == Name.TYPE_SURNAME
        ))
        data = []
        for i in resources:
            data.append(i.text)

        return data

    # 获取复姓
    @staticmethod
    def surname_multi():
        resources = model.all(Name, and_(
            Name.type == Name.TYPE_SURNAME_MULTI
        ))
        data = []
        for i in resources:
            data.append(i.text)

        return data

